
.config-field {
  margin-bottom: 16px;
  max-width: 100%;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  font-size: 12px !important;
}

.config-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--color-text-secondary);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.config-field input {
  width: 100%;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
  background: var(--color-background);
  color: var(--color-text-primary);
  font-size: 13px;
  transition: all 0.3s;
  box-sizing: border-box;
  word-break: break-all;
}
.ant-select-item-option {
  font-size: 12px !important;
}
.ant-select-selection-item {
  line-height: 24px !important;
  font-size: 12px !important;
}
.config-field input:hover {
  border-color: var(--color-primary);
}

.config-field input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
}

/* antd Input 组件样式覆盖 */
.config-field .ant-input {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  word-break: break-all !important;
  background-color: var(--color-background) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text-primary) !important;
}

.config-field .ant-input:hover {
  border-color: var(--color-primary) !important;
}

.config-field .ant-input:focus,
.config-field .ant-input-focused {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1) !important;
}

.config-field .ant-input::placeholder {
  color: var(--color-text-secondary) !important;
  opacity: 0.5;
}

.config-field .ant-input-disabled {
  background-color: var(--color-background) !important;
  opacity: 0.5;
}

.entity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.entity-item button {
  padding: 4px 8px;
  border: none;
  border-radius: var(--border-radius-small);
  background: var(--color-error);
  color: white;
  cursor: pointer;
  font-size: 13px;
}

/* 传感器配置样式 */
.sensor-config-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 100%;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.sensor-config-group {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.sensor-config-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sensor-config-item {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-all;
}

.sensor-config-type {
  font-size: 13px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  width: 80px;
}

.sensor-config-item .ant-select {
  flex: 1;
  width: 100%;
}

.sensor-config-item .ant-select-dropdown {
  width: auto !important;
  min-width: 200px !important;
  max-width: 300px !important;
}


/* 灯光配置样式 */
.lights-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.light-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.light-item-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.light-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-buttons {
  display: flex;
  gap: 8px;
}

.order-button {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
  background: var(--color-background);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 13px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.order-button:hover:not(:disabled) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.order-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.delete-button {
  padding: 4px 12px;
  border: none;
  border-radius: var(--border-radius-small);
  background: var(--color-error);
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 13px;
}

.delete-button:hover {
  background: var(--color-error-dark);
}

.add-button {
  margin-top: 12px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--border-radius-small);
  background: var(--color-primary);
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 13px;
  align-self: flex-start;
}

.add-button:hover {
  background: var(--color-primary-dark);
}

/* 摄像头配置样式 */
.cameras-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.camera-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.camera-item > input,
.camera-item > .ant-select {
  margin-bottom: 8px;
}

/* 媒体播放器配置样式 */
.media-players-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.media-player-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.media-player-item > input,
.media-player-item > .ant-select {
  margin-bottom: 8px;
}

/* 窗帘配置样式 */
.curtains-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.curtain-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.curtain-item > input,
.curtain-item > .ant-select {
  margin-bottom: 8px;
}

/* 路由器配置样式 */
.router-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.router-field {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: center;
}

/* NAS配置样式 */
.nas-config {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nas-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
  padding: 16px;
}

.nas-section h4 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 16px;
  font-weight: 500;
}

.nas-field,
.volume-field,
.drive-field,
.m2ssd-field {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: center;
}

.volume-config,
.drive-config,
.m2ssd-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
  padding: 16px;
}

.volume-config input,
.drive-config input,
.m2ssd-config input {
  margin-bottom: 12px;
}

/* 通用字段名称样式 */
.field-name {
  font-size: 13px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 响应式布局 */
@media (max-width: 768px) {
  .router-field,
  .nas-field,
  .volume-field,
  .drive-field,
  .m2ssd-field,
  .waterpuri-field,
  .electricity-field,
  .room-field {
    grid-template-columns: 1fr;
    gap: 8px;
    max-width: 100%;
  }
  
  .field-name {
    margin-bottom: 4px;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 传感器配置项样式优化 */
  .sensor-config-item {
    flex-direction: column;
    padding: 8px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .sensor-config-type {
    width: 100%;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 灯光配置样式优化 */
  .light-item {
    padding: 12px;
  }

  .light-item-content {
    gap: 8px;
  }

  /* 摄像头配置样式优化 */
  .camera-item {
    padding: 12px;
  }

  /* 媒体播放器配置样式优化 */
  .media-player-item {
    padding: 12px;
  }

  /* 窗帘配置样式优化 */
  .curtain-item {
    padding: 12px;
  }

  /* NAS配置样式优化 */
  .nas-section {
    padding: 12px;
  }

  .nas-section h4 {
    font-size: 13px;
  }

  .volume-config,
  .drive-config,
  .m2ssd-config {
    padding: 12px;
  }

  /* 脚本配置样式优化 */
  .script-item {
    padding: 12px;
  }

  /* 按钮样式优化 */
  .config-field button,
  .sensor-config-groups > button,
  .lights-config > button,
  .cameras-config > button,
  .media-players-config > button,
  .curtains-config > button,
  .scripts-config > button {
    padding: 8px 16px;
    margin-top: 8px;
  }

  /* 房间灯光概览配置样式优化 */
  .light-overview-config {
    padding: 12px;
    gap: 12px;
  }

  .light-room-item {
    padding: 12px;
  }

  .light-room-item button {
    width: 100%;
  }

  /* 表单控件样式优化 */
  .ant-select,
  .ant-input,
  input {
    height: 36px;
  }

  .ant-select-selection-item {
    line-height: 34px !important;
  }

  /* 优化下拉菜单在移动端的显示 */
  .ant-select-dropdown {
    width: calc(100vw - 32px) !important;
    max-width: calc(100vw - 32px) !important;
    box-sizing: border-box !important;
    left: 16px !important;
  }

  .ant-select-item {
    padding: 8px !important;
  }

  .ant-select-item-option-content {
    white-space: normal !important;
    word-break: break-all !important;
    width: 100% !important;
  }
}

/* 脚本配置样式 */
.scripts-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.script-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.script-item > input,
.script-item > .ant-select {
  margin-bottom: 8px;
}

/* 通用按钮样式 */
.config-field button {
  padding: 8px 16px;
  border: none;
  border-radius: var(--border-radius-small);
  background: var(--color-primary);
  color: white;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  align-self: flex-start;
}

.config-field button:hover {
  background: var(--color-primary-dark);
}

.config-field button[type="delete"],
.entity-item button,
.light-item button,
.camera-item button,
.media-player-item button,
.curtain-item button,
.sensor-config-group  button,
.volume-config button,
.drive-config button,
.m2ssd-config button,
.climate-feature button,
.illuminance-config button,
.light-overview-config button,
.script-item button {
  background: var(--color-error);
}

.config-field button[type="delete"]:hover,
.entity-item button:hover,
.light-item button:hover,
.camera-item button:hover,
.media-player-item button:hover,
.curtain-item button:hover,
.sensor-config-group button:hover,
.script-item button:hover,
.volume-config button:hover,
.drive-config button:hover,
.m2ssd-config button:hover,
.climate-feature button:hover,
.illuminance-config button:hover,
.light-overview-config button:hover {
  background: var(--color-error-dark);
}

/* antd Select 组件样式覆盖 */
.config-field .ant-select {
  width: 100% !important;
  max-width: 100% !important;
}

.config-field .ant-select-selector {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.config-field .ant-select-selection-item {
  width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* 配置项标题和输入框布局 */
.config-field-row {
  display: grid;
  grid-template-columns: minmax(60px, 120px) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.config-field-row label {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.config-field-row .ant-select,
.config-field-row input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* 通用删除按钮样式 */
.config-field button.delete-btn,
.entity-item button,
.light-item button,
.camera-item button,
.media-player-item button,
.curtain-item button,
.sensor-config-group button,
.script-item button,
.volume-config button,
.drive-config button,
.m2ssd-config button,
.light-overview-config button,
.climate-feature button,
.illuminance-config button {
  padding: 8px 24px;
  border: none;
  border-radius: var(--border-radius-small);
  background: var(--color-error);
  color: white;
  cursor: pointer;
  font-size: 13px;
  width: 100px;
  text-align: center;
  margin-top: 12px;
}

.config-field button.delete-btn:hover,
.entity-item button:hover,
.light-item button:hover,
.camera-item button:hover,
.media-player-item button:hover,
.curtain-item button:hover,
.sensor-config-group button:hover,
.script-item button:hover,
.volume-config button:hover,
.drive-config button:hover,
.m2ssd-config button:hover {
  background: var(--color-error-dark);
}

/* 添加按钮样式 */
.config-field button.add-btn,
.sensor-config-groups > button,
.lights-config > button,
.cameras-config > button,
.media-players-config > button,
.curtains-config > button,
.scripts-config > button {
  padding: 8px 24px;
  border: none;
  border-radius: var(--border-radius-small);
  background: var(--color-primary);
  color: white;
  cursor: pointer;
  font-size: 13px;
  align-self: flex-start;
  margin-top: 12px;
}

.config-field button.add-btn:hover,
.sensor-config-groups > button:hover,
.lights-config > button:hover,
.cameras-config > button:hover,
.media-players-config > button:hover,
.curtains-config > button:hover,
.scripts-config > button:hover {
  background: var(--color-primary-dark);
}

/* 净水器配置样式 */
.waterpuri-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.waterpuri-field {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: center;
}

.waterpuri-field .field-name {
  font-size: 13px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 电量监控配置样式 */
.electricity-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.electricity-field {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: center;
}

.electricity-field .field-name {
  font-size: 13px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.climate-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.climate-feature {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.feature-header {
  display: flex;
  gap: 12px;
}

.feature-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feature-selects {
  display: flex;
  gap: 12px;
}

.feature-content button {
  align-self: flex-end;
  width: 100px;
}

/* 光照传感器配置样式 */
.illuminance-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.illuminance-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.illuminance-item > input,
.illuminance-item > .ant-select {
  margin-bottom: 8px;
}

/* 房间灯光概览配置样式 */
.light-overview-config {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
  background: var(--color-background);
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
}

.light-room-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-small);
  position: relative;
}

.room-field {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: center;
}

.room-field label {
  margin: 0;
  white-space: nowrap;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.room-field .ant-select,
.room-field input {
  width: 100%;
}

/* 删除按钮样式 */
.light-room-item button {
  padding: 8px 24px;
  border: none;
  border-radius: var(--border-radius-small);
  background: var(--color-error);
  color: white;
  cursor: pointer;
  font-size: 13px;
  width: 100px;
  text-align: center;
  margin-top: 12px;
  align-self: flex-start;
}

.light-room-item button:hover {
  background: var(--color-error-dark);
}

/* 添加按钮样式 */
.config-field > button {
  padding: 8px 24px;
  border: none;
  border-radius: var(--border-radius-small);
  background: var(--color-primary);
  color: white;
  cursor: pointer;
  font-size: 13px;
  width: 100px;
  text-align: center;
  margin-top: 12px;
}

.config-field > button:hover {
  background: var(--color-primary-dark);
}

